Excel Number Format
Use the FormatString property to control how numeric values are displayed in any Excel Cell or Range with IronXL for Python.
Using worksheet["A2"] selects the Range for the specified address. To access an individual Cell, the First() method can be used. However, the FormatString property can be set directly on both a Cell and a Range, so First() can often be omitted. Additional number formats can be applied using the same approach, as demonstrated in the code example below.
How to Use Excel Number Formats in Python
- Install IronXL for Python to apply number formats
- Load an existing Excel file using the
Loadmethod - Set the
FormatStringproperty of a cell to specify the desired number format - Save the modified spreadsheet using
SaveAs
In the code example, the WorkBook.Load method opens an existing Excel file. The worksheet["A2"] syntax selects a specific cell, and the FormatString property is set to "0.00" to display the value with two decimal places. Finally, SaveAs saves the modified workbook to a new file.






